﻿using System;
using System.Collections.Generic;
using System.Text;

namespace csharpcore7_ch3_Struct
{
    public class StructExample1
    {
       
        static void _Main()
        {
            Point p1 = new Point();
            Point p2 = new Point(1, 1);
            Console.WriteLine(p1.x +"," + p1.y);
            Console.WriteLine(p2.x + "," + p2.y);
        }
    }
    /// <summary>
    /// 结构体
    /// </summary>
    public struct Point
    {
        public int x, y;
        public Point(int x, int y) { this.x = x;this.y = y; }
    }

    //public struct IllegalPoint
    //{
    //    int x = 1;      //Illegal,field initializer
    //    int y;
    //    public Point() { } //Illegal: parameterless constructor
    //    public Point(int x) { this.x = x; } //Illegal: must assign field y
    //}
}
